import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
  JstPurchaseEnterWarehouseOrderVO,
  JstPurchaseEnterWarehouseOrderForm,
  JstPurchaseEnterWarehouseOrderQuery
} from '@/api/jdAndJstSceneClassification/purchasingProcess/jstPurchaseEnterWarehouseOrder/types';

/**
 * 查询聚水潭-采购入库单列表
 * @param query
 * @returns {*}
 */

export const listJstPurchaseEnterWarehouseOrder = (query?: JstPurchaseEnterWarehouseOrderQuery): AxiosPromise<JstPurchaseEnterWarehouseOrderVO[]> => {
  return request({
    url: '/dataCheck/jst/purchaseEnterWarehouseOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 01、定义后端接口
 * 查询聚水潭-采购入库单列表
 * 业务查询条件：根据operator_warehouse_owner名称为国内工厂在途仓和深圳/东莞仓查询
 * @param query
 * @returns {*}
 */
export const listPurchaseEnterWarehouseOrderByDongGuanAndGuoNei = (
  query?: PurchaseEnterWarhouseOrderQuery
): AxiosPromise<PurchaseEnterWarehouseOrderVO[]> => {
  return request({
    url: '/dataCheck/jst/purchaseEnterWarehouseOrder/list-by-dongguan-and-guonei',
    method: 'get',
    params: query
  });
};

/**
 * 查询聚水潭-采购入库单详细
 * @param id
 */
export const getJstPurchaseEnterWarehouseOrder = (id: string | number): AxiosPromise<JstPurchaseEnterWarehouseOrderVO> => {
  return request({
    url: '/dataCheck/jst/purchaseEnterWarehouseOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增聚水潭-采购入库单
 * @param data
 */
export const addJstPurchaseEnterWarehouseOrder = (data: JstPurchaseEnterWarehouseOrderForm) => {
  return request({
    url: '/dataCheck/jst/purchaseEnterWarehouseOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改聚水潭-采购入库单
 * @param data
 */
export const updateJstPurchaseEnterWarehouseOrder = (data: JstPurchaseEnterWarehouseOrderForm) => {
  return request({
    url: '/dataCheck/jst/purchaseEnterWarehouseOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除聚水潭-采购入库单
 * @param id
 */
export const delJstPurchaseEnterWarehouseOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dataCheck/jst/purchaseEnterWarehouseOrder/' + id,
    method: 'delete'
  });
};
